﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace StoreAppLibDemo.ViewModel
{
    public class AppBarButtonPageView : StoreAppLib.BindableBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AppBarButtonPageView"/> class"
        /// </summary>
        public AppBarButtonPageView()
        {
            this.MenuCommand = new StoreAppLib.RelayCommand(this.OnMenuCommand);
        }

        /// <summary>
        /// Variable to hold the selected menu label.
        /// </summary>
        private string selectedMenuLabel;

        /// <summary>
        /// Gets or sets the selected menu label.
        /// </summary>
        /// <value>
        /// The selected menu label.
        /// </value>
        public string SelectedMenuLabel
        {
            get
            {
                return this.selectedMenuLabel;
            }

            set
            {
                this.SetProperty(ref this.selectedMenuLabel, value);
            }
        }

        private void OnMenuCommand(object obj)
        {
            this.SelectedMenuLabel = (obj as StoreAppLib.Controls.MenuItem).Label;
        }

        /// <summary>
        /// Variable to hold the ICommand implementation that describes the command logic.
        /// </summary>
        private ICommand menuCommand;

        /// <summary>
        /// Gets the ICommand implementation that describes the command logic.
        /// </summary>
        /// <value>
        /// The ICommand implementation that describes the command logic.
        /// </value>
        public ICommand MenuCommand
        {
            get
            {
                return this.menuCommand;
            }

            private set
            {
                this.SetProperty(ref this.menuCommand, value);
            }
        }
    }
}
